package com.ruoyi.bizsys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.bizsys.domain.LoanIou;
import com.ruoyi.bizsys.domain.LoanOrder;
import com.ruoyi.bizsys.vo.LoanIouVo;

import java.util.List;

/**
 * 贷款借据Service接口
 *
 * @author african-loan
 * @date 2021-12-30
 */
public interface ILoanIouService extends IService<LoanIou> {
    /**
     * 查询贷款借据
     *
     * @param id 贷款借据ID
     * @return 贷款借据
     */
    public LoanIou selectLoanIouById(Long id);

    /**
     * 查询贷款借据列表
     *
     * @param loanIou 贷款借据
     * @return 贷款借据集合
     */
    public List<LoanIou> selectLoanIouList(LoanIou loanIou);

    public List<LoanIou> getList(LoanIou loanIou);

    /**
     * 入催任务，查询正常的借据列表
     *
     * @param custNo
     * @param repayDate
     * @return
     */
    public List<LoanIou> findNormalLoanIous(String custNo, String repayDate);

    /**
     * 新增贷款借据
     *
     * @param loanIou 贷款借据
     * @return 结果
     */
    public int insertLoanIou(LoanIou loanIou);

    /**
     * 修改贷款借据
     *
     * @param loanIou 贷款借据
     * @return 结果
     */
    public int updateLoanIou(LoanIou loanIou);

    /**
     * 批量删除贷款借据
     *
     * @param ids 需要删除的贷款借据ID
     * @return 结果
     */
    public int deleteLoanIouByIds(Long[] ids);

    /**
     * 删除贷款借据信息
     *
     * @param id 贷款借据ID
     * @return 结果
     */
    public int deleteLoanIouById(Long id);

    /**
     * 还款后未再申请贷款
     *
     * @return
     */
    List<String> selRepaymentNoApplyAgain();

    /**
     * 是否有未结清的借据
     * SysConfig配置逾期天数的限制条件：raiseLimit_overdueDays
     *
     * @param custNo
     * @return
     */
    int overdueIouCount(String custNo);

    List<String> selRepaymentNoApplyAgainMoreThan10();

    LoanIou getLoanIouDetail(LoanIou loanIouQuery);

    LoanIou getLoanIouByLoanSerialNo(String loanSerialNo);

    List<LoanIou> getListByCustNo(String custNo);

    /**
     * 初始化借据
     *
     * @param loanOrder
     * @return
     */
    boolean initializeIOUByOrder(LoanOrder loanOrder);

    List<LoanIouVo> selectIouTask(String intervalHours);

    LoanIou getLatestOne(String custNo);

    int getHaveDeIou(String custNo);

    List<LoanIou> getDeferredTotalDay(String custNo);

    String selectMinDueData(String custNo);

    String selectzdzhangdanricha(String custNo);

    String getwhdwsjcha2(String custNo);

    /**
     * 获取当前最新的未结清的借据
     *
     * @return
     */
    LoanIou getLoanIouNotSettled(String custNo);

    List<String> getDueIouCustNo();

    /**
     * 获取到期&逾期未结清借据
     *
     * @param custNo
     * @return
     */
    List<LoanIou> getCustDueIou(String custNo);

    /**
     * 查找到期未结清的借据（包括当天到期和已逾期的借据，如借据已延期则到期日以延期到期日为准）
     * 注意延期
     * @param custNo
     * @return
     */
    List<LoanIou> getCardWithholdIouByCustNo(String custNo);
}
